import ReactDOM from 'react-dom'

// function Teacher(name, age) {
//   this.name = name
//   this.age = age
// }
// Teacher.prototype.sayHi = function () {
//   console.log('大家好我是', this.name);
// }
// const stu = new Teacher('小明', 20)
// stu.sayHi()

class Teacher2 {
  constructor(name, age) {
    this.name = name
    this.age = age
  }
  sayHi() {
    console.log('大家好我是', this.name);
  }
}
class Person {
  constructor(name, gender) {
    this.name = name
    this.gender = gender
  }
  sayHi2() {
    console.log('方法');
  }
}
class Chinese extends Person {
  constructor(name, gender) {
    super(name, gender)
    this.eat = '吃饭'
    this.sing = '唱歌'
  }
  ping() {
    console.log('乒乓球');
  }
}
const stu = new Teacher2('小美', 20)
stu.sayHi()
const c1 = new Chinese('小美', 20)
console.log(c1);


// 练习
class Animal {
  constructor(name, type) {
    this.name = name
    this.type = type
  }
  eat() {
    console.log('干饭干饭');
  }
}
class Dog extends Animal {
  constructor(name, type) {
    super(name, type)
    this.les = 4
  }
  bark() {
    console.log('汪汪');
  }
}
let d = new Dog('小金', '金毛')
console.log(d);
d.bark()
d.eat()












const element = <div>
  <h1>函数组件</h1>
</div>

ReactDOM.render(element, document.getElementById('root'))